package org.mct.mes.entity;

import jakarta.persistence.Id;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.time.OffsetDateTime;
import java.util.List;

@ToString
@Getter
@Setter
@Table(name = "mes_raw_data2")
public class MesRawData2 {
    @Id
    public Long id;

    @Column(value = "device_code")
    public String device_code;

    @Column(value = "enter_time")
    public OffsetDateTime enter_time;

    @Column(value = "guid")
    public String guid;

    @Column(value = "json_content")
    public String json_content;

    @Column(value = "json_response")
    public String json_response;

    @Column(value = "port_url")
    public String port_url;

    @Column(value = "post_time")
    public OffsetDateTime post_time;

    @Column(value = "respon_time")
    public OffsetDateTime respon_time;

    @Column(value = "unit_no")
    private Integer unit_no;

    public MesRawData2(Long id,Integer unit_no, String device_code, OffsetDateTime enter_time, String guid, String json_content, String json_response, String port_url, OffsetDateTime post_time, OffsetDateTime respon_time) {
        this.id = id;
        this.device_code = device_code;
        this.enter_time = enter_time;
        this.guid = guid;
        this.json_content = json_content;
        this.json_response = json_response;
        this.port_url = port_url;
        this.post_time = post_time;
        this.respon_time = respon_time;
        this.unit_no=unit_no;
    }

    public MesRawData2(String port_url,Integer unit_no, String json_response, String json_content, String guid, String device_code, Long id) {
        OffsetDateTime now = OffsetDateTime.now();
        this.respon_time = now;
        this.post_time = now;
        this.port_url = port_url;
        this.json_response = json_response;
        this.json_content = json_content;
        this.guid = guid;
        this.enter_time = now;
        this.device_code = device_code;
        this.id = id;
        this.unit_no=unit_no;
    }

    public MesRawData2() {
    }
}